package com.sinoglobal.sinostore.adapter;

import android.util.SparseArray;
import android.view.View;

public class ViewHolder {
	public static <T extends View> T getViewById(View convertView ,int id){
		SparseArray<View> viewHolder = (SparseArray<View>) convertView.getTag();
		if(null == viewHolder){
			viewHolder = new SparseArray<View>();
			convertView.setTag(viewHolder);
		}
		View childView = viewHolder.get(id);
		if(null == childView){
			childView = convertView.findViewById(id);
			viewHolder.put(id, childView);
		}
		return (T) childView;
	}
}
